package com.wc.AlgoOJ_homework.AlgoOJ_BL2.I_冰山;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/4/1 19:58
 * @description http://43.138.190.70:8888/p/509?tid=6602a6e518e03a818a4bf047
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 100010;
    // 记录每一个冰山的个数
    static Map<Long, Long> map1 = new HashMap<>(), map2 = new HashMap<>();
    static int n, m;
    static long x, y, k;
    static int P = 998244353;

    public static void main(String[] args) {
        n = sc.nextInt();
        m = sc.nextInt();
        k = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            x = sc.nextLong();
            map1.put(x, map1.getOrDefault(x, 0L) + 1);
        }
        while (m-- > 0) {
            // 先修改
            x = sc.nextLong();
            y = sc.nextLong();
            map2 = new HashMap<>();
            for (long w : map1.keySet()) {
                long num = map1.get(w);
                w += x;
                if (w >= k) {
                    map2.put(k, (map2.getOrDefault(k, 0L) + num) % P);
                    map2.put(1L, (map2.getOrDefault(1L, 0L) + (w - k) * num) % P);
                } else if (w > 0) {
                    map2.put(w, (map2.getOrDefault(w, 0L) + num) % P);
                }
            }
            if (y != 0)
                map2.put(y, (map2.getOrDefault(y, 0L) + 1) % P);
            long res = 0;
            for (long w : map2.keySet()) {
                res = (res + w * map2.get(w) % P) % P;
            }
            map1 = map2;
            out.println(res);
        }
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
